
const { url } = require('./constants');

const fs = require('fs')
const path = require('path')
const template = require('./modules/art-template');
const { get } = require('./modules/axios');

get(url).then(res => {
  const videoList = res.data.data.list.vlist;

  // 开始处理数据传入template
  // 处理播放量
  // 处理时间

  // -------------------------
  const htmlSrc = fs.readFileSync(path.join(__dirname, '/lib/index.html'), 'utf-8')
  const html = template.render(htmlSrc, {data: videoList});
  // console.log(html)
  fs.writeFileSync('./lib/lib.html', html)
})
